﻿using System;
using System.Security.Principal;

namespace NCommet.Core.Agents
{
    /// <summary>
    /// IWhoAmI provides information about the currently logged-in user,
    /// the roles that have been assigned to that user and the roles that exist in the system.
    /// </summary>
    /// <remarks>
    /// IWhoAmI is an abstraction that eliminates dependencies to a specific users and roles system.
    /// </remarks>
    public interface IWhoAmI
    {
        /// <summary>
        /// Gets the current logged-in user.
        /// </summary>
        /// <returns>The current logged-in user.</returns>
        IPrincipal GetCurrentUser();

        /// <summary>
        /// Gets the roles of the given user.
        /// </summary>
        /// <param name="username">The username of the given user.</param>
        /// <returns>The roles of the given user.</returns>
        string[] GetRolesOfUser(string username);

        /// <summary>
        /// Gets all the roles that exist in the roles system.
        /// </summary>
        /// <returns>An array of all the roles that exist in the roles system.</returns>
        string[] GetAvailableRoles();
    }
}
